﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Layout.master" AutoEventWireup="true"
    CodeFile="itemPage.aspx.cs" Inherits="itemPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="./themes/blue/css/item.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:HiddenField ID="HidH" runat="server" Value="0" />
    <asp:HiddenField ID="HidM" runat="server" Value="0" />
    <asp:HiddenField ID="HidS" runat="server" Value="0" />
    <asp:HiddenField ID="HidRemainingTime" runat="server" Value="0" />
    <asp:HiddenField ID="HidHoursLabelID" runat="server" Value="0" />
    <asp:HiddenField ID="HidMinutesLabelID" runat="server" Value="0" />
    <asp:HiddenField ID="HidSecondsLabelID" runat="server" Value="0" />
    <div class="content">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
        </asp:Timer>
        <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" OnDataBound="ListView1_DataBound">
            <ItemTemplate>
                <!-- 
            <%# HidRemainingTime.Value= Eval("con_lai").ToString()%>                     
            -->
                <div id="deal-intro" class="cf"><div class="simpleCart_shelfItem">
                    <h1>
                        <a class="deal-today-link" href="#">Deal hôm nay:</a>
                        <span class="item_name"><%# Eval("ten_sp") %></span> - <%# Eval("mo_ta_sp") %>
                    <div class="main">
                        <div class="deal-buy">
                            <div class="deal-price-tag"><div class="item_id2" style="visibility:hidden;"><%# Eval("id") %></div>
                            <input value="1" class="item_Quantity" type="text" style="visibility:hidden;"/>
                            </div>
                            <p class="deal-price">
                               <strong class="item_price">
                                    <%# Eval("gia_km") %>
                                    <br>
                                    VNĐ </strong><span><a class="item_add" href="javascript:;">
                                        <img src="themes/blue/images/button-deal-buy.png"></a> </span>
                            </p>
                        </div>
                        <table class="deal-discount">
                            <tbody>
                                <tr>
                                    <td colspan="3" align="center" style="padding-top: 15px; padding-bottom: 15px; border-bottom: #339A99 1px solid">
                                        <span style="font: bold 1.3em arial">Giá gốc:&nbsp;<%# Eval("gia_goc") %></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="50%" style="border-right: #339A99 1px solid; padding-top: 10px" valign="top">
                                        Giảm giá<br>
                                        <span style="font: bold 1.1em arial">
                                            <%# Eval("giam") %>%</span>
                                    </td>
                                    <td width="50%" valign="top" style="padding-top: 10px">
                                        Tiết kiệm<br>
                                        <span style="font: bold 1.1em arial">
                                            <%# Eval("tiet_kiem") %></span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <div class="deal-box deal-timeleft deal-on" id="deal-timeleft" curtime="1333893619000"
                            diff="442780000">
                            <h3>
                                Thời gian còn lại</h3>
                            <div class="limitdate">
                                <ul id="counter">
                                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                            <li><b><span>
                                                <asp:Label runat="server" Text="Label" ID="lbHours" /></span>Giờ</b> </li>
                                            <li><b><span>
                                                <asp:Label runat="server" Text="Label" ID="lbMinutes" /></span>Phút</b> </li>
                                            <li><b><span>
                                                <asp:Label runat="server" Text="Label" ID="lbSeconds" /></span>Giây</b></li>
                                        </ContentTemplate>
                                        <Triggers>
                                            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                                        </Triggers>
                                    </asp:UpdatePanel>
                                </ul>
                            </div>
                        </div>
                        <div class="deal-box deal-status deal-status-open" id="deal-status">
                            <p class="deal-buy-tip-top">
                                <asp:Label runat="server" Text="Label" ID="lbBought" />
                            </p>
                            <p class="deal-buy-tip-btm">
                                <asp:Label runat="server" Text="Label" ID="lbRemain" />
                            </p>
                            <p class="deal-buy-on" style="line-height: 200%;">
                                <asp:Label runat="server" Text="Label" ID="lbCanBuy" />
                            </p>
                        </div>
                        <div>
                        <br /><br />
                        <div id="fb-root"></div>
<script>    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/vi_VN/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    } (document, 'script', 'facebook-jssdk'));</script>
    <div class="fb-like" data-send="true" data-layout="button_count" data-width="250" data-show-faces="false"></div>
    </div>
                    </div></div>
                    <div class="side">
                        <div class="deal-buy-cover-img" id="team_images">
                            <div class="mid">
                                <ul>
                                    <li class="first" style="opacity: 1; left: 0Px;">
                                        <img src='<%# "upload/"+Eval("anh_1")%>'></li>
                                </ul>
                            </div>
                        </div>
                        <div align="justify" style="padding-top: 10px; width: 680px;">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tbody>
                                    <tr>
                                        <td style="font-weight: bold;" width="50%">
                                            <span style="font-size: medium; color: #80b04f;">Điểm nổi bật:<br>
                                            </span>
                                        </td>
                                        <td style="border-left: 1px solid rgb(204, 204, 204);">
                                            &nbsp;
                                        </td>
                                        <td style="padding-left: 10px; font-weight: bold;">
                                            <p>
                                                <span style="font-size: medium; color: #80b04f;">Điều kiện:</span></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-left: 10px; padding-right: 10px;" valign="top" align="justify">
                                            <div align="justify">
                                            </div>
                                            <span style="font-weight: bold;"></span>
                                            <%# Eval("dac_trung") %>
                                        </td>
                                        <td style="border-left: 1px solid rgb(204, 204, 204);">
                                            <strong>
                                                <br>
                                            </strong>
                                        </td>
                                        <td style="padding-left: 20px;" valign="top" align="left">
                                            <%# Eval("dieu_kien_ap_dung") %>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <br>
                            <br>
                        </div>
                    </div>
                </div>
            </ItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:babydealConnectionString %>"
            SelectCommand="SELECT id, ten_sp, mo_ta_sp, ngay_bat_dau, ngay_ket_thuc, DATEDIFF(s ,GETDATE() ,ngay_ket_thuc)  AS con_lai, gia_km, gia_goc,  (gia_goc - gia_km) as tiet_kiem,(gia_goc - gia_km) * 100 / gia_goc AS giam, so_luong_toi_da, so_luong_toi_thieu, noi_dung, dieu_kien_ap_dung, dac_trung, da_duoc_duyet, anh_1 FROM khuyen_mai WHERE (id = @id) AND (da_duoc_duyet = 1)">
            <SelectParameters>
                <asp:QueryStringParameter Name="id" QueryStringField="id" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <div id="deal-stuff" class="cf">
            <div class="clear box box-split">
                <div class="box-top">
                </div>
                <div class="box-content cf">
                    <div class="main" id="team_main_side">
                        <h2 id="detail">
                            Thông tin
                        </h2>
                        <asp:ListView ID="ListView2" runat="server" DataSourceID="SqlDataSource1">
                            <ItemTemplate>
                                <div class="blk detail">
                                    <%# Eval("noi_dung") %>
                                </div>
                            </ItemTemplate>
                        </asp:ListView>
                    </div>
                    <div class="side" id="team_partner_side_1">
                        <asp:ListView ID="ListView3" runat="server" DataSourceID="SqlDataSource2">
                            <ItemTemplate>
                                <div id="side-Business">
                                    <h2 style="text-align: left">
                                        <%# Eval("ten_doanh_nghiep") %>
                                    </h2>
                                    <div style="margin-top: 10px;" align="left">
                                        <br />
                                        <img src='<%# "images/"+ Eval("anh_1") %>' width="100%" />
                                        <br />
                                        <%# Eval("dia_chi") %><br>
                                        - ĐT:
                                        <%# Eval("so_dt") %>
                                        <br>
                                    </div>
                                    <div align="left">
                                        <a href="" target="_blank"></a>
                                    </div>
                                </div>
                            </ItemTemplate>
                        </asp:ListView>
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:babydealConnectionString %>"
                            SelectCommand="SELECT dn.ten_doanh_nghiep, dn.so_dt, dn.dia_chi, dn.anh_1 FROM khuyen_mai AS km INNER JOIN doanh_nghiep AS dn ON km.id_doanh_nghiep = dn.id WHERE (km.id = @id)">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="id" QueryStringField="id" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>
                    <div id="sidebar">
                        <div class="sbox side-support-tip">
                            <div align="left" style="background-color: #e3f0d6;">
                                <h2>
                                    Deal trong ngày
                                </h2>
                            </div>
                            <div align="left" style="padding-bottom: 30px; background-color: #FAFAFA;">
                                <asp:ListView ID="ListView4" runat="server" DataSourceID="SqlDataSource3">
                                    <ItemTemplate>
                                        <div style="padding-bottom: 20px; cursor: pointer" onclick="<%#"window.location='./itemPage.aspx?id="+Eval("id")+"'" %>">
                                            <div style="color: #FFFFFF; cursor: pointer" class="aListBPLine">
                                                <h3>
                                                    <a href='<%# "itemPage.aspx?id="+Eval("id") %>' style="color: #000000; font-size: 13px;">
                                                        <%# Eval("ten_sp") %></a></h3>
                                                <div class="dInfoBRNew">
                                                    <a href='<%# "itemPage.aspx?id="+Eval("id") %>' style="color: #000000; font-size: 13px;">
                                                        <img src='<%# "images/"+Eval("anh_1")%>' border="0" width="200" height="120"></a></div>
                                                <div class="dSOListBRN">
                                                    <div class="div_TietKiem">
                                                        <strong class="styleText14">Giảm</strong><br>
                                                        <strong class="styleText15">
                                                            <%# Eval("giam") %>%</strong></div>
                                                </div>
                                                <div class="PriceDealBRL">
                                                    <div class="divPrice">
                                                        <span class="styleText17">Giá trị:&nbsp;<strong class="StyleTextGT lineHorizontal styleText13"
                                                            style="text-decoration: line-through"><%# Eval("gia_goc") %>VNĐ</strong></span>
                                                    </div>
                                                    <div class="div_infoMoney">
                                                        <div class="div_TextInfoMoney">
                                                            <p class="styleText14" style="margin-left: 10px;">
                                                                <strong>Còn Lại</strong></p>
                                                            <p class="pGiaTien" align="center">
                                                                <strong class="styleText5">
                                                                    <%# Eval("gia_km") %>&nbsp;VNĐ</strong></p>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="pLineDotted">
                                            <hr size="1" width="99%">
                                        </div>
                                    </ItemTemplate>
                                </asp:ListView>
                                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:babydealConnectionString %>"
                                    SelectCommand="SELECT TOP (5) id, ten_sp, gia_km, gia_goc, (gia_goc - gia_km) / gia_goc * 100 AS giam, anh_1 FROM khuyen_mai WHERE (GETDATE() BETWEEN ngay_bat_dau AND ngay_ket_thuc) AND (da_duoc_duyet = 1) AND (id &lt;&gt; @id) ORDER BY NEWID()">
                                    <SelectParameters>
                                        <asp:QueryStringParameter Name="id" QueryStringField="id" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="clear box box-split">
            <div class="box-top">
                <div class="box-content cf" style="position: relative;">
                    <div class="group">
                        <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource4" 
                            Width="100%">
                        <AlternatingItemTemplate>
                                <div style="background-color: #99CCFF; width: 100%;">
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("ho_ten") %>'></asp:Label>
                                    <p>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("noi_dung") %>'></asp:Label>
                                    </p>
                                </div>
                            </AlternatingItemTemplate>
                            <ItemStyle Width="100%" />
                            <ItemTemplate>
                                <div style="background-color: #CCFFCC; width: 100%;">
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("ho_ten") %>'></asp:Label>
                                    <p>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("noi_dung") %>'></asp:Label>
                                    </p>
                                </div>
                            </ItemTemplate>                            
                        </asp:DataList>
                        <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:babydealConnectionString %>" 
                            SelectCommand="SELECT tv.ho_ten, bl.noi_dung FROM thanh_vien AS tv , binh_luan AS bl where tv.id = bl.id_thanh_vien and bl.id_khuyen_mai=@id">
                            <SelectParameters>
                                <asp:QueryStringParameter Name="id" QueryStringField="id" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <asp:Label ID="lbNhanXet" runat="server" Text="Nhận xét của bạn:" Font-Bold="True"></asp:Label>
                        <asp:TextBox Style="width: 90%; margin-left: 20px; height: 100px;" ID="tbNhanXet" runat="server" TextMode="MultiLine"
                            CssClass="text_area" Rows="10" Columns="60" CausesValidation="False" ></asp:TextBox>
                            
                        <asp:RequiredFieldValidator ID="rfvNhanXet" runat="server" ErrorMessage="Nhận xét không được bỏ trống"
                            SetFocusOnError="True" ControlToValidate="tbNhanXet"></asp:RequiredFieldValidator>
                        <br />                        
                        <asp:Button ID="btOk" runat="server" Text="Đăng Nhân Xét" 
                            onclick="btOk_Click1" />
                    </div>
                </div>
            </div>
        </div>
    </div>    
    <script>
        simpleCart({
            checkout: {
                type: "PayPal",
                email: "vuvynhat@gmail.com"
            }

        });
        </script>
</asp:Content>
